﻿Public Class frmmain

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        If MsgBox("คุณต้องการออกจากโปรแกรมหรือไม่", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "ยืนยัน") = MsgBoxResult.No Then Exit Sub
        Me.Dispose()
    End Sub

    Private Sub PERSOnToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PERSOnToolStripMenuItem.Click
        frmOPPerson.MdiParent = Me
        frmOPPerson.Show()
        frmOPPerson.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub DBSettingToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DBSettingToolStripMenuItem.Click
        ' frmDBSetting.MdiParent = Me
        frmDBSetting.ShowDialog()
    End Sub

    Private Sub ผพฒนาToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ผพฒนาToolStripMenuItem.Click
        'AboutBox.MdiParent = Me
        AboutBox.ShowDialog()
    End Sub
    Private Sub HomepageToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HomepageToolStripMenuItem.Click

        System.Diagnostics.Process.Start("http://farmonline.blogspot.com/")
    End Sub


    Private Sub frmmain_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
        If MsgBox("คุณต้องการออกจากโปรแกรมหรือไม่", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "ยืนยัน") = MsgBoxResult.No Then Exit Sub
    End Sub

    Private Sub frmmain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            Me.Text = " OPPP Correct Data Tools " & " V." & Application.ProductVersion & " : โปรแกรมตรวจสอบข้อมูล OPPP และ 18 แฟ้ม สำหรับ HOSxP"

            If ClsSQLhelper.MyShowDBSetting = "1" Then
                frmDBSetting.ShowDialog()
            End If

            'Dim Strsql As String
            'Dim _sqlite As New ClsSQLite
            'Strsql = "delete from m_person"
            '_sqlite.SQLiteExecute(Strsql)

            'Strsql = "delete from m_diag"
            '_sqlite.SQLiteExecute(Strsql)

            'Strsql = "delete from m_service"
            '_sqlite.SQLiteExecute(Strsql)

            'Strsql = "delete from m_proced"
            '_sqlite.SQLiteExecute(Strsql)

            'Strsql = "delete from patient"
            '_sqlite.SQLiteExecute(Strsql)

        Catch ex As Exception

        End Try
    End Sub

    Private Sub SystemSettingToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SystemSettingToolStripMenuItem.Click
        frmSystemSetting.MdiParent = Me
        frmSystemSetting.Show()
    End Sub



    Private Sub ServiceToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ServiceToolStripMenuItem.Click
        frmOPService.MdiParent = Me
        frmOPService.Show()
        frmOPService.WindowState = FormWindowState.Maximized
    End Sub

    Private Sub SQLQueryToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SQLQueryToolStripMenuItem.Click
        With frmsqlquery
            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With

    End Sub

    Private Sub CryptToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CryptToolStripMenuItem.Click
        frmCrypt.ShowDialog()
    End Sub

    Private Sub VersionHistoryToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VersionHistoryToolStripMenuItem.Click
        With frmChangeLog
            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With
    End Sub

    Private Sub ANCToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ANCToolStripMenuItem.Click
        With frmPPAnc
            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With
    End Sub

    Private Sub FRXToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FRXToolStripMenuItem.Click
        With frmOPDrug
            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With
    End Sub

    Private Sub DIAGToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DIAGToolStripMenuItem.Click
        With BtnPrint
            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With
    End Sub

    Private Sub ProcedToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProcedToolStripMenuItem.Click
        With frmOPProced
            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With
    End Sub



    Private Sub OPPPNHSOToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OPPPNHSOToolStripMenuItem.Click
        System.Diagnostics.Process.Start("http://op.nhso.go.th/op/")
    End Sub

    Private Sub HOSxPToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HOSxPToolStripMenuItem.Click
        System.Diagnostics.Process.Start("http://hosxp.net")
    End Sub

    Private Sub FindICD10ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FindICD10ToolStripMenuItem.Click
        frmICD10.ShowDialog()
    End Sub

    Private Sub PersonToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PersonToolStripMenuItem1.Click
        With frmHOSxPPerson
            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With
    End Sub

    Private Sub DrugToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DrugToolStripMenuItem.Click
        With frmdruginformation
            .MdiParent = Me
            .ShowDialog()
        End With
    End Sub

    Private Sub UpdatePersonCIDToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdatePersonCIDToolStripMenuItem.Click
        With frmUpdatePersonCID
            .MdiParent = Me
            .Show()
        End With
    End Sub

    Private Sub FPERSONToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FPERSONToolStripMenuItem.Click
        With frmPPPerson
            .MdiParent = Me
            .Show()
        End With
    End Sub


    Private Sub TS_Summary_Point_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TS_Summary_Point.Click
        frmPoint.MdiParent = Me
        frmPoint.Show()
    End Sub

    Private Sub TS_Error_Summary_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TS_Error_Summary.Click
        frmError_Sumary.ShowDialog()
    End Sub

    Private Sub TS_Find_HOSxP_Information_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TS_Find_HOSxP_Information.Click
        frmSearchInfo.MdiParent = Me
        frmSearchInfo.Show()
    End Sub

    Private Sub EPIToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EPIToolStripMenuItem.Click

        With frmPPEPI
            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With
    End Sub

    Private Sub PPMCHToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PPMCHToolStripMenuItem.Click
        With frmPPMCH
            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With
    End Sub


    Private Sub FpToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FpToolStripMenuItem.Click
        With frmPPFP
            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With
    End Sub

    Private Sub PPToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PPToolStripMenuItem.Click
        With frmPPPP
            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With
    End Sub

    Private Sub FindVnToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FindVnToolStripMenuItem.Click
        With frmChkVN
            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With

    End Sub

    Private Sub FindICD9ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FindICD9ToolStripMenuItem.Click
        frmICD9.ShowDialog()
    End Sub

    Private Sub DuplicateCIDToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Cursor = Cursors.WaitCursor
        'With frmprintDuplicateCID
        '    Dim CID_Criteria As String
        '    'If DataGridView1.RowCount = 0 Then Exit Sub
        '    'For i As Integer = 0 To DataGridView1.RowCount - 1


        '    '    If DataGridView1.Rows(i).Cells("CID").Value.ToString.Trim() <> "" And DataGridView1.Rows(i).Cells("CID").Value.ToString.Trim() <> "0000000000000" Then
        '    '        CID_Criteria = CID_Criteria & "'" & DataGridView1.Rows(i).Cells("CID").Value.ToString.Trim() & "',"
        '    '    End If
        '    'Next

        '    Strsql = "Select CID from m_person where CODE_ID like '%PE9203%'"
        '    Dim DT_m_person_Dup As New DataTable
        '    DT_m_person_Dup = MySql.GetMYSQLDataTable(Strsql, "m_person")
        '    For i = 1 To DT_m_person_Dup.Rows.Count - 1
        '        CID_Criteria = CID_Criteria & "'" & DT_m_person_Dup.Rows(i).Item("CID").ToString & "',"
        '    Next


        '    If CID_Criteria <> Nothing Then
        '        CID_Criteria = Mid(CID_Criteria, 1, Len(CID_Criteria) - 1) & ")"
        '        .CID_Criteria = CID_Criteria

        frmRptDupCID.ShowDialog()
        '    End If
        'Me.Cursor = Cursors.Default
        ' End With
    End Sub


    Private Sub MnRptCIDDup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnRptCIDDup.Click
        With frmRptDupCID
            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With
    End Sub


    Private Sub MnCIDNotComplete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnCIDNotComplete.Click
        With frmRptCIDNotCoplete
            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With
    End Sub

    Private Sub MnReportDiag_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnReportDiag.Click
        With frmRptDiag

            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With
    End Sub

    Private Sub MnRptChkRefService_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnRptChkRefService.Click
        With frmRptChekRefService

            .MdiParent = Me
            .Show()
            .WindowState = FormWindowState.Maximized
        End With
    End Sub

    Private Sub TestToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles TestToolStripMenuItem.Click
        FrmTest.Show()
    End Sub
End Class
